<template>
	<view>
		<view class="list">
			<view class="content flex-column">
				<view class="todayNewAddList flex-space-between" v-for="(item, i) in list" :key="i">
					<text class="name">{{ item.agentName+'('+item.agentNo+')'
          }}<text v-if="item.agentNo == user.agentNo" class="iconfont icon-xiaoxi1 me"><text
								class="font">我</text></text></text>
					<text class="value">{{ item.count }}</text>
				</view>
			</view>
		</view>

		<uni-load-more :status="loadMore"></uni-load-more>
	</view>
</template>

<script>
	import {
		totalAgentIndex
	} from "_a/data/team";
	import loadMoreData from "@/mixins/loadmore";
	export default {
		mixins: [loadMoreData],
		data() {
			return {
				list: [],
				type: 'underAgent', //addUnderAgent 新增自属  underAgent 新增代理商
				loadMore: 1,
			};
		},
		onLoad(options) {
			this.type = options.type || "underAgent";
			this.getList();
		},
		computed: {
			user() {
				return this.$store.getters.user || {};
			},
		},
		methods: {
			getList() {
				let params = {
					pageNum: this.pageNum,
					pageSize: this.pageSize,
					...this.queryParams,
				};
				totalAgentIndex().then((res) => {
					if (res.code == 200) {
						let data = res.data;
						if (this.type == 'underAgent') {
							this.list = data.underAgentExtendDetail;
						} else {
							this.list = data.addUnderAgentDetai;
						}
						this.loadMoreStatusDeal(this.list);
					}
				});
			},
			reachBottomCallBack() {
				this.getList();
			},
			init() {
				this.$nextTick(() => {
					this.list = [];
				});
			},
		},
	};
</script>
<style scoped lang='scss'>
	.list{
		margin: R(20);
		border-radius: R(10);
		background-color: #fff;
	}
	.content {
		.name {
			.me {
				position: relative;
				color: #f3e8a1;
				font-size: R(46);

				.font {
					position: absolute;
					left: R(20);
					top: R(10);
					font-size: R(20);
					color: #000;
				}
			}
		}

		font-size: R(26);

		.todayNewAddList {
			padding: R(15) R(70) R(15) R(10);
		}
	}
</style>
